import sys
sys.path.append("../")
from model.CommonDb import *
from services.BaseService import *
from frameworks.utils.FileUtil import *
import pandas as pd
import datetime

class AccountDetailService(BaseService):
    def __init__(self):
        super(AccountDetailService, self).__init__()
        self.db = CommonDb("account_detail","stock")

    def addDetail(self,info):
        return self.db.add(info)

    def getAccount(self,actid):
        sql = "select * from account_detail where actid='" + actid + "' order by exchange_date desc limit 1"
        return self.db.executeMap(sql)

    def updateAccount(self,actid,money):
        info = {
            "hand_money": money
        }
        return self.db.update(info,"actid='" + str(actid) + "'")
